<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <th:block th:include="include :: header('立项申请新增')"/>
</head>
<body class="pear-container" onunload="myClose()">



<form class="layui-form" action=""  th:object="${ApplyProject}" readonly="true">

	<div class="layui-form-item layui-hide">
		<label class="layui-form-label">id</label>
		<div class="layui-input-block">
			<input readonly  id="proId" type="text" name="id" lay-verify="title"
				   autocomplete="off" class="layui-input">
		</div>
	</div>

	<div class="layui-form-item layui-hide">
		<label class="layui-form-label">专家审核状态</label>
		<div class="layui-input-block">
			<input readonly  id="expertPass" type="text" name="expertPass" lay-verify="title"
				   autocomplete="off" class="layui-input">
		</div>
	</div>

	<h4 align="center" style="font-size: large">青海省社会科学规划项目成果评估指标体系  <i id="scoreTips" class="layui-icon layui-icon-tips" style="font-size: large"></i></h4><br>
	<div class="layui-card">
	<div class="layui-card-body">

							<div class="layui-form-item">
								<table class="layui-table">
									<thead>
									<tr><th style="width: 10.5263%;">评价指标</th><th style="width: 5.97482%;">权重</th><th style="width: 27.6599%;">指标说明</th><th>专家评分</th></tr>
									</thead>
									<tbody>
									<tr><td>论证</td><td>5</td><td>主要考察研究思路、研究内容、重点难点、研究方法、基本观点和创新之处。</td><td><input name="scoreArgument" title="10" type="radio" value="10" /><input name="scoreArgument" title="9" type="radio" value="9" /><input name="scoreArgument" title="8" type="radio" value="8" /><input name="scoreArgument" title="7" type="radio" value="7" /><input name="scoreArgument" title="6" type="radio" value="6" /><input name="scoreArgument" title="5" type="radio" value="5" /><input name="scoreArgument" title="4" type="radio" value="4" /><input name="scoreArgument" title="3" type="radio" value="3" /></td></tr><tr><td>研究基础</td><td>3</td><td>主要考察课题负责人的前期相关研究成果和主要参考文献。</td><td><input name="scoreBase" title="10" type="radio" value="10" /><input name="scoreBase" title="9" type="radio" value="9" /><input name="scoreBase" title="8" type="radio" value="8" /><input name="scoreBase" title="7" type="radio" value="7" /><input name="scoreBase" title="6" type="radio" value="6" /><input name="scoreBase" title="5" type="radio" value="5" /><input name="scoreBase" title="4" type="radio" value="4" /><input name="scoreBase" title="3" type="radio" value="3" /></td></tr><tr><td>研究团队</td><td>2</td><td>主要考察研究团队成员学历、专业结构和专长特长</td><td><input name="scoreTeam" title="10" type="radio" value="10" /><input name="scoreTeam" title="9" type="radio" value="9" /><input name="scoreTeam" title="8" type="radio" value="8" /><input name="scoreTeam" title="7" type="radio" value="7" /><input name="scoreTeam" title="6" type="radio" value="6" /><input name="scoreTeam" title="5" type="radio" value="5" /><input name="scoreTeam" title="4" type="radio" value="4" /><input name="scoreTeam" title="3" type="radio" value="3" /></td></tr><tr><td>综合评价</td><td colspan="2">是否建议入围</td><td><input name="scoreShortlist" title="建议入围" type="radio" value="1" /><input name="scoreShortlist" title="不建议入围" type="radio" value="0" /></td></tr>
									</tbody>
								</table>
							</div>
</div>
</div>

	<h4 align="center" style="font-size: large">评审意见</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
			<div class="layui-form-item">
				<div class="layui-input-block" id="adviceContentEdit">
					<textarea id="adviceContent" name="adviceContent" style="display: none;"></textarea>
				</div>

			</div>
	</div><br><br><br><br><br>

</div>
	<div class="bottom" style="position: fixed;bottom: 0">
		<div class="button-container">
			<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
					lay-filter="applyScore-add">
				<i class="layui-icon layui-icon-ok"></i>
				提交
			</button>
			<button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
				<i class="layui-icon layui-icon-refresh"></i>
				重置
			</button>

		</div>
	</div>

</form>
<script>
	function myClose(){
		parent.closeSelf();
	}
</script>


<th:block th:include="include :: footer"/>
<script>
    layui.use(['form','laydate','jquery','table','layedit'], function () {
		let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath+"/ApplyScoreController";
		var layedit=layui.layedit;

		$("#scoreTips").mouseover(function() {
			layer.tips('1、由于评审材料没有进行匿名处理，请您对此次评审活动进行保密</br>' +
					'2、在与“评价指标”对应的“专家评分”栏选择一个分值，不能漏选，也不能多选，权重仅供参考；</br>' +
					'3、如建议该课题入围，请在“综合评价”栏上选择；</br>' +
					'4、“评审意见”着重对拟立项的课题题目，提出合理的意见，原则上不保留副标题。', this, {
				tips: [3, "#170c0c"],time:6000,
			});
		});

		//配置评审意见编辑的富文本编辑器
		var layeditAdviceContent=layedit.build('adviceContent',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器

		//配置评审意见只读的富文本编辑器
		var layeditAdviceContentRead=layedit.build('adviceContentRead',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器



		form.on('submit(applyScore-add)', function (data) {

			data.field.projectId = $("#proId").val();
			//论证分数
			var scoreArgumentRes = 0;
			$('input[name="scoreArgument"]:checked').each(function(){
				if($(this).val() != null || $(this).val() != 0)
					scoreArgumentRes = $(this).val();
			});
			//研究基础分数
			var scoreBaseRes = 0;
			$('input[name="scoreBase"]:checked').each(function(){
				if($(this).val() != null || $(this).val() != 0)
					scoreBaseRes = $(this).val();
			});
			//研究团队分数
			var scoreTeamRes = 0;
			$('input[name="scoreTeam"]:checked').each(function(){
				if($(this).val() != null || $(this).val() != 0)
					scoreTeamRes = $(this).val();
			});

			//权重总分
			data.field.scoreTotal = 0.5*scoreArgumentRes+0.3*scoreBaseRes+0.2*scoreTeamRes;
			//富文本
			data.field.adviceContent = layedit.getContent(layeditAdviceContent);
			layer.confirm('确定要提交信息，提交后将无法更改', {icon: 3, title: '提示'}, function (index) {
				let loader = layer.load();
				$.ajax({
					url: MODULE_PATH + '/add/' + data.field.projectId,
					data: data.field,
					dataType: 'json',
					contentType: 'application/x-www-form-urlencoded',
					type: 'post',
					success: function (result) {
						if (result.code == 200) {
							layer.msg(result.msg, {icon: 1, time: 1000}, function () {
								parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
								parent.closeSelf();
								layer.close(loader);
							});
						} else {
							layer.msg(result.msg, {icon: 2, time: 1000});
							layer.close(loader);
						}
					}
				})
			});
			return false;
		});


    })
</script>
</body>
</html>